<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Movie Directory</title>
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
  <title>Movies: <%= controller.action_name %></title>
  <%= javascript_include_tag "prototype" %>
  <%= stylesheet_link_tag 'scaffold' %>
  <%= stylesheet_link_tag 'hhac' %>
  <script type="text/javascript">
function render_ajaxCon_for_xlogin()
{
  state = $("ajaxCon").getAttribute("state");
  if (state == "empty")
  {
    new Ajax.Updater("ajaxCon", "/login/xlogin", {
      method:"get", evalScript:true, asynchronous:false});
    $("ajaxCon").setAttribute("state", "nonempty");
  }
  else
  {
    while(child = $("ajaxCon").firstChild)
      $("ajaxCon").removeChild(child);
    $("ajaxCon").setAttribute("state", "empty");
  }
}
  </script>

</head>

<% user = current_user %>
<body>
  <div id="page">
    <div id="header">
      <div id="head-stuff">
        <% if user && user.privilege > 1 %>
        <div id="login-info">
        <% else %>
        <div id="login-info">
        <% end %>
        <% if user %>
<li><%= link_to user.uname, "/users/#{user.id}", :class=>"login-link" %></li>
<li><%= link_to "退出", "/login/logout", :class=>"login-link" %></li>
<% else %>
<li><%= link_to "登录", "/login/index", :class=>"login-link" %>
<li><%= link_to "注册", "/users/new", :class=>"login-link" %></li>
<% end %>
        </div>
      </div>
      <div id="head-logo">
      <%= image_tag "hhac-top.gif", :alt=>"hhac-top.gif" %>
      </div>
    </div>

    <div id="content">
      <div id="nav">
        <ul>
          <li><a class="navlink" href="/albums">专辑</a></li>
          <li><a class="navlink" href="/movies">视频</a></li>
          <li><a class="navlink" href="/comments">评论</a></li>
        </ul>


      </div>
      <div id="main">
        <div id="left">
          <p style="color:green"><%= flash[:notice] %></p>

          <%= yield %>

        </div>
        <div id="right">
          <div id="ajaxCon" state="empty">
          </div>
        </div>
      </div>
    </div>

    <div id="footer">
      <div id="foot-logo">
      <%= image_tag "hhac.gif", :alt=>"hhac.gif" %>
      </div>
      <div id="foot-stuff">
      河蟹之家
      <%= link_to "关于HHAC", "/hhac/about" %><br/>
      (c) 2009 HHAC. All rights reserved.
      </div>
    </div>
  </div>
</body>
</html>
